package com.hong.concurrent.chapter5;

/**
 * @Author csh
 * @Description
 * @Date 2018/6/30 20:35
 */
public class User extends Thread {
    //姓名
    private final String myName;
    //我的地址
    private final String myAddress;
    //类型
    private final Gate gate;

    public  User(String myName,String myAddress,Gate gate){
        this.gate=gate;
        this.myAddress=myAddress;
        this.myName=myName;
    }

    @Override
    public void run() {
        System.out.println(myName+" BEGIN");
        while (true){
            this.gate.pass(myName,myAddress);
        }
    }
}
